#!/usr/bin/env python

import distribute_setup
distribute_setup.use_setuptools()

from setuptools import setup, Extension

#import os, sys
#from distutils.core import setup, Extension

import os.path
lib_dirs = os.path.abspath('../boinc-win-i386/lib/')
inc_dirs = os.path.abspath('../boinc-win-i386/include/')
libboinc = os.path.join(lib_dirs, 'libboinc.lib')
libboinc_api = os.path.join(lib_dirs, 'libboinc_api.lib')

print lib_dirs, libboinc, libboinc_api

import distutils.sysconfig

original_get_config_var = distutils.sysconfig.get_config_var

def fake_get_config_var(name):
    if name == "CC":
        return "gcc"
    else:
        return original_get_config_var(name)
    
distutils.sysconfig.get_config_var = fake_get_config_var 

# May need to adjust these to suit your system, but a standard installation of the BOINC client from source will put things in these places
boinc = Extension('boinc', runtime_library_dirs=[lib_dirs],
	extra_objects=[libboinc, libboinc_api],
	sources = ['boincmodule.cpp'],
	libraries = ['stdc++'],
	library_dirs = [lib_dirs],
	include_dirs = [inc_dirs],
	extra_compile_args = ['-fPIC'], extra_link_args = ['-fPIC'])

setup (name = 'PyBoinc',
       version = '0.3.2',
       description = 'Basic python bindings for BOINC network computing package',
       author = 'David Weir',
       author_email = 'david.weir03@imperial.ac.uk',
       url = 'http://plato.tp.ph.ic.ac.uk/~djw03/boinc-python/',
       #packages = ['pyboinc'],
       install_requires  = ['setuptools'],
       long_description = """
       Python bindings for BOINC APIs.
       """,
       classifiers=[
          "License :: OSI Approved :: GPL v2 or later License",
          "Programming Language :: Python",
          "Topic :: Distributive Computing",
          "Topic :: Software Development :: Libraries :: Python Modules",
          "Intended Audience :: Developers",
          "Development Status :: 0.3.2"],
       ext_modules = [boinc]
       )
